/*
 * @Author: 'zhangkeqq' '2211709169@qq.com'
 * @Date: 2025-07-25 12:00:32
 * @LastEditors: 'zhangkeqq' '2211709169@qq.com'
 * @LastEditTime: 2025-07-25 16:56:24
 * @FilePath: \vue3-admin-node\vue3-admin\vite.config.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/*
 * @Author: 'zhangkeqq' '2211709169@qq.com'
 * @Date: 2025-07-24 15:34:56
 * @LastEditors: 'zhangkeqq' '2211709169@qq.com'
 * @LastEditTime: 2025-07-24 18:00:25
 * @FilePath: \vue3-admin\vite.config.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { createSvgIconsPlugin } from  'vite-plugin-svg-icons'
import path from 'path';
// https://vite.dev/config/
export default defineConfig({
  plugins: [vue(),
      createSvgIconsPlugin({
        iconDirs: [path.resolve(process.cwd(), 'src/assets/icons/svg')],
        symbolId: 'icon-[dir]-[name]',
    }),
  ],
    //配置scss
  // css:{
  //     preprocessorOptions: {
  //       scss: {
  //         // javascriptEnabled: true,
  //         additionalData: `@use "@/styles/variable.scss";`,
  //       },
  //     },
  // },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: `@use "@/style/variable.scss";` // 全局导入变量文件，可选
      }
    }
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src') // 设置别名，方便在项目中引用路径
    }
  },
  server:{
    port:8080,//默认启动的端口号
    open:true,//自动打开默认浏览器
    cors:true,//允许跨域
  }
})
